<template>
  <div class="feed-back">
    <nav-bar title="意见反馈"></nav-bar>

    <div class="feed-back-info">
      <div class="title">意见与反馈</div>
      <div class="content">
        <van-field
          v-model="feedObj.content"
          rows="4"
          autosize
          label="留言"
          type="textarea"
          maxlength="150"
          placeholder="请输入留言"
          show-word-limit
        />
      </div>
      <div class="phone">
        <van-field
          v-model="feedObj.phone"
          placeholder="邮箱/手机号/微信号"
          label="联系方式"
        />
      </div>
    </div>
    <div class="submit" @click="sendFeed">提交</div>
  </div>
</template>

<script>
import { sendFeedBack } from "@/api/pages/feed-back";
import NavBar from "@/components/common/nav-bar";
export default {
  data() {
    return {
      feedObj: {
        name: JSON.parse(localStorage.getItem("userInfo")).nickName,
        phone: "",
        openId: localStorage.getItem("openId"),
        content: "",
      },
    };
  },
  methods: {
    sendFeed() {
      sendFeedBack(this.feedObj).then((res) => {
        if (res.data) {
          this.$toast.success('上传成功');
          this.$router.go(-1);
        }
      });
      console.log(this.feedObj);
    },
  },
  components: {
    "nav-bar": NavBar,
  },
};
</script>

<style lang="scss" scoped>
.feed-back {
  background-color: #fff;
  min-height: 665px;
  .feed-back-info {
    margin-top: 1px;
    padding: 0 10px;
    box-sizing: border-box;
    .title {
      line-height: 40px;
      border-bottom: 1px solid #f4f4f4;
    }
    .content {
      border-bottom: 1px solid #f4f4f4;
    }
    .phone {
      border-bottom: 1px solid #f4f4f4;
    }
  }
  .submit {
    text-align: center;
    margin: 0 auto;
    margin-top: 50px;
    width: 95%;
    height: 50px;
    border-radius: 5px;
    line-height: 50px;
    color: #fff;
    text-align: center;
    background: #b4282d;
  }
}
</style>